package com.example.demo.threadDemo.aCreateThreadName;

/**
 * @Description Demo02
 * @Author songchuanlong
 * @Date 2025-04-14
 */


/**
 * 通过构造器设置名字
 *
 * 父类的Thread里面有构造(String name)，可以直接继承
 */
public class Demo02 {
    public static void main(String[] args) {
        MyThread02 myThread02 = new MyThread02("aaaaa");
        myThread02.start();

        MyThread02 myThread03 = new MyThread02("bbbbb");
        myThread03.start();

        Thread t = Thread.currentThread();
        for (int i = 1; i <=3; i++) {
            System.out.println(t.getName()+"："+i);
        }
    }
}
